<?php
/**
 * This is the FireFeed CategoryHistory search form.
 * 
 * @uses       Zend_Form
 * @package    FireFeed
 * @subpackage Form
 */
class Form_CategoryHistory extends Zend_Form 
{
    /**
     * init() routine called when Zend_Form objects are created.
     * It make sense to define form elements in this method.
     * 
     * @see    http://framework.zend.com/manual/en/zend.form.html
     * @return void
     */ 
    public function init()
    {
        $this->setAction('/category/loadcategorieslist');
        $this->setMethod('POST');
        
        $this->setElementFilters(array('StringTrim'));
        
        $this->setAttrib('class', 'formstyleSearch');
        $this->setAttrib('id', 'searchcategory');
        
        
        $owner = new Zend_Form_Element_Select('owner');
        $owner->setLabel('owner')
	                  ->setAttrib('class', 'field NoHints')
	                  ->setRequired(false)
	                  ->setRegisterInArrayValidator(false)
	                  ->setMultiOptions(array())
	                  ->setDecorators(array(
	                       array('ViewHelper'),
	                       array('Label', array('separator'=>' ', 'class'=>'gray labelfield')),
	                       array('HtmlTag', array('tag' => 'div', 'class' => 'element-group-selectblock startField')),
	                       array('Errors')
	                  ));

        
        // Add Name element
        $content = new Zend_Form_Element_Text('contains');
        $content->setLabel('contains')
                ->setAttrib('class', 'field')
                ->setRequired(false)
                ->clearValidators()
                ->setDecorators(array(
                      array('ViewHelper', array('helper'=>'formText')),
                      array('Label', array('class'=>'gray labelfield')),
                      array('HtmlTag', array('tag' => 'div', 'class' => 'element-group-form-search separatorField')),
                      array('Errors', array('tag' => 'span'))
                ));
                 
        // Add a submit button
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel('search')
               ->setDecorators(array(
                   array('ViewHelper', array('helper'=>'formSubmit')),
                    array('HtmlTag', array('tag' => 'div', 'class' => 'element-group-form-searchSubmit separatorField')),
        ));
        
        $this->addElements(array(
            $owner,
            $content,
            $submit
        ));
        
        $this->setDecorators(array(
            'FormElements',
            'Form'
        ));
    }
}

